var ns;
var app = new Vue({
    el: '#app',
    data: {
        list: [],
        form: {
            status: 0, // 0-全部 1-正常 2-异常
            StatusName: '全部',
            keywords: '',
            Day:'', 
            ProjectID:0,
            ProjectIDs: [],
        },
        IsAnalysis:false,
        PlanType: 3,
        total: {
            ProcessCount: 0,
            CompleteCount: 0
        },
    },
    methods: {
        get_data: function () {
            var that = this;
            var options = {};
            options.action = "getdaycleaningtask";
            options.Status = that.form.status;
            options.RegionName = that.form.keywords;
            options.PlanType = that.PlanType;
            options.Day = that.form.Day;
            options.IsAnalysis=that.IsAnalysis;
            options.ProjectID = JSON.stringify(that.form.ProjectIDs);
            ns.post(options, function (succeed, data, err) {
                if (succeed) {
                    that.list = data.DataList;
                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            }, {
                toast: true
            });
        },
        open_details: function (item) {
            ns.openWin('bjlh_details_frm', '工作点记录详情', {
                id: item.ID
            });
        },
        do_search: function () {
            var that = this;
            that.get_data();
        },
        onDealTaskTime:function(time){
            return ns.SetTime_style(time)
        },
    }
});
apiready = function () {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.form.Day = api.pageParam.Day || '';
    app.IsAnalysis = api.pageParam.IsAnalysis || false;
    app.form.ProjectID=api.pageParam.ProjectID || 0;
    if( app.form.ProjectID){
        app.form.ProjectIDs=[];
        app.form.ProjectIDs.push(app.form.ProjectID);
    }
    // app.PlanType=api.pageParam.TaskType,
    toast = new auiToast();
    setTimeout(function () {
        app.get_data();
    }, 500);
    ns.init_search();
}
